package org.fatewa.engine.exception;

import org.fatewa.engine.advice.protocol.RayquazaResponse;
import org.fatewa.engine.design.advice.AbstractExceptionProcessor;
import org.springframework.http.HttpStatus;
import org.springframework.jdbc.BadSqlGrammarException;

/**
 * SQL 错误
 *
 * @author fatewa
 */
public class BadSqlGrammarExceptionProcessor extends AbstractExceptionProcessor<BadSqlGrammarException> {
    @Override
    public RayquazaResponse map(BadSqlGrammarException e) {
        return new RayquazaResponse()
                .msg("数据库SQL异常，请核对参数是否正确")
                .code(HttpStatus.BAD_REQUEST);
    }
}
